﻿@using hc.epm.DataModel.Business;
@using System.Collections.Generic;
@model List<EPM_FaceOperateLog>
@{
    ViewBag.Title = "考勤日志";
}

<div class="content-right date-wrap fl c">
    <div class="main mt5">
        <div class="layui-form">
            <table class="layui-table" style="text-align:center;word-break:break-all;word-wrap:break-word">
                <thead>
                    <tr>
                        @*<th width="5%" class="table-center">
                                <input type="checkbox" lay-skin="primary" lay-filter="allChoose" />
                            </th>*@
                        <th width="5%" class="table-center">序号</th>
                        <th width="10%" class="table-center">接口类型</th>
                        <th width="35%" class="table-center">请求参数</th>
                        <th width="40%" class="table-center">返回参数</th>
                        <th width="10%" class="table-center">操作结果</th>
                    </tr>
                </thead>
                <tbody>
                    @{
                        int index = 0;
                    }
                    @if (Model != null && Model.Count() > 0)
                    {
                        foreach (var item in Model)
                        {
                            index++;
                            <tr>
                                @*<td class="table-center">
                                        <input type="checkbox" lay-skin="primary" />
                                        <input type="hidden" name="id-@item.SId" id="id-@item.SId" value="@item.SId" />
                                    </td>*@
                                <td class="table-center">@index</td>
                                <td>@item.APIType</td>
                                <td>@item.RequestJson</td>
                                <td>@item.ResponseJson</td>
                                <td>@(item.IsSuccess == true ? "成功" : "失败")</td>
                            </tr>
                        }
                    }
                    else
                    {
                        <tr>
                            <td colspan="6" class="table-center">
                                暂无数据
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
        <div id="page"></div>
    </div>
</div>

<script>
    //若无数据隐藏分页组件
    if ('@ViewBag.Total' == 0) {
        $("#page").hide();
    }
    layui.use(['layer', 'form', 'element', 'laypage'], function () {
        var layer = layui.layer, form = layui.form, element = layui.element, $ = layui.jquery, laypage = layui.laypage;
        //分页
        laypage.render({
            elem: 'page',
            count: '@ViewBag.Total',
            curr: '@ViewBag.pageIndex',
            layout: ['prev', 'page', 'next', 'skip', 'count'],
            jump: function (obj, first) {
                if (!first) {
                    //得到了当前页，用于向服务端请求对应数据
                    var curr = obj.curr;
                    var search = $("form").serialize();
                    window.location.href = "/User/GetFaceLogList?pageIndex=" + curr + "&" + search;
                }
            }
        });
    });

    //关闭弹出层
    $('.cancel').on("click", function () {
        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        parent.layer.close(index);//关闭窗口
    });
</script>
